<?php
/**
 * Miffos framework
 * ----------------------------------------------
 *
 * Copyright (c) 2008, 2009 Martin Sadový (http://sodae.cz)
 *
 * This source file is subject to the "Miffos license" that is bundled
 * with this package in the file license.txt.
 *
 * @copyright  Copyright (c) 2008, 2009 Martin Sadový
 * @license    license.txt
 * @link       http://miffos.sodae.cz
 * @package    miffos
 * @version    $Id$
 */

  class FormRadioInput extends FormControl
  {
    protected $tag = '';

    public function __construct($form, $name, $label, $data)
    {
        parent::__construct($form, $name, $label);
        $this->decodeData($this->element, $data);
    }

    private function decodeData(&$instance,$data)
    {
        $instance->create('',"\n");
        foreach($data as $key=>$value){
            $instance->create('input')->name($this->name)->type('radio')->value($value)->id($key.'-radio');
            $instance->create('label')->for($key.'-radio')->setText($value);
            $instance->create('br');
            $instance->create('',"\n");
            
        }
    }

  }


?>